object FunDetails05 {
  def main(args: Array[String]): Unit = {
    mysqlCon()
    println("--------------------------")
    // 从左到右覆盖
    mysqlCon("127.0.0.1", 777)
    println("--------------------------")
    // 如果我们希望指定覆盖某个默认值，则使⽤带名参数即可,⽐如修改⽤户名和密码
    mysqlCon(user = "ddaimm", pwd = "1021")
    println("**************************")
    // fun("v2") 报错
    fun(p2 = "v2")
  }

  def mysqlCon(add: String = "localhost", port: Int = 3306,
               user: String = "root", pwd: String = "root"): Unit = {
    println("add=" + add)
    println("port=" + port)
    println("user=" + user)
    println("pwd=" + pwd)
  }

  def fun(p1: String = "v1", p2: String) {
    println(p1 + p2)
  }
}

